<script type="text/javascript">

	function showAnswer()
	{
		document.getElementById('score0').disabled=false;
		document.getElementById('score1').disabled=false;
		document.getElementById('score2').disabled=false;
		document.getElementById('score3').disabled=false;
		document.getElementById('score4').disabled=false;
		document.getElementById('score5').disabled=false;
		document.getElementById('insideanswer').style.display = "block";
		document.getElementById('studentanswer').style.display = "block";
		document.getElementById('myref').style.visibility = "visible";
		document.getElementById('score4').focus();
		document.getElementById('myshowanswer').disabled=false;
		}

</script>
<div class="mydiv">
<div class="controls">
<style>
    .controls img {
        padding: 0 3px;
        cursor: pointer;
    }
</style>

<?php
global $FULLME;
global $COURSE;
$editString = '';
$commands = "<img onclick='command.what.value=\"add\";command.submit(); return true;' src=\"{$CFG->pixpath}/t/switch_plus.gif\" />";
$commands .= "<img  onclick='command.what.value=\"edit\";command.submit(); return true;' src=\"{$CFG->pixpath}/t/edit.gif\" />";
$commands .= "<img  onclick='command.what.value=\"delete\";command.submit(); return true;' src=\"{$CFG->pixpath}/t/delete.gif\" />";
$commands .= "<img  onclick='command.what.value=\"questionlist\";command.submit(); return true;' src=\"{$CFG->pixpath}/t/log.gif\" />";
$commands .= "<img  onclick='command.what.value=\"studentlist\";command.submit(); return true;' src=\"{$CFG->pixpath}/t/user.gif\" style=\"padding-right: 30px;\" />";
if(!empty($isteacher)) echo $commands;
?>


Category: <?php echo $catmenu ?> 

<?php
$lockbutton = "<img onclick='command.what.value=\"catlock\";command.submit(); return true;' src=\"{$CFG->pixpath}/t/lock.gif\" />";
echo $lockbutton;
?>
</div>

<form action="view.php" method="get" name="command">
<input name="what" type="hidden" value="delete" />
<input name="instid" type="hidden" value="<?php echo ($instid); ?>" />
<input name="qid" type="hidden" value="<?php echo ($qid); ?>" />
</form>
<?php 
//die('question count'.$qcount);
//if(empty($qcount) && empty($isteacher))
if(empty($qcount))
	{
//die('question counta'.$qcount);
		print_heading(get_string('questions_completed','memorybank',userdate(nextViewingDay(),'%H:%M')));

    		global $CFG,$COURSE;
    		redirect($CFG->wwwroot, get_string('return_to_moodle','memorybank',"<a href=$CFG->wwwroot>$CFG->wwwroot</a>"),10);
	} else
	{?>
<div class="myquestionlegend"><?php echo get_string('question')?></div>
<div class="myquestion"><?php echo $thequestion ?></div>

<div class="myanswerlegend"><?php echo get_string('answer')?></div>
<div class="myanswer">
<div id="insideanswer" class="insideanswer" style="display:none" ><?php echo $theanswer ?></div>
<div id="studentanswer" class="studentanwer" style="display:none" ><input name="studentanswer" type="hidden" size="20" onkeyup=""></div>
</div>
<div class="myref" id="myref" style="visibility:hidden"><?php echo $thereference ?></div>

<input onclick="showAnswer();" type="button" value="Show answer" class="myshowanswer" id="myshowanswer" />
	
	
<form action="view.php" method="get" name="SendAnswers">
<table class="mytable"  border="2" cellspacing="2" cellpadding="2" >
 <caption>
 <?php echo get_string("gradeyouranswer", "memorybank")?>
 </caption>
 
 <tr>
    <td><input type="submit" disabled="true" name="level" id="score0" value="0" class="answerbutttons"/></td>
    <td><input type="submit" disabled="true" name="level" id="score1" value="1" class="answerbutttons"/></td>
    <td><input type="submit" disabled="true" name="level" id="score2" value="2" class="answerbutttons"/></td>
    <td><input type="submit" disabled="true" name="level" id="score3" value="3" class="answerbutttons"/></td>
    <td><input type="submit" disabled="true" name="level" id="score4" value="4" class="answerbutttons"/></td>
    <td><input type="submit" disabled="true" name="level" id="score5" value="5" class="answerbutttons"/></td>
  </tr>
    <tr>
    <td class="gradehelp"><?php echo get_string("levelzero", "memorybank")?></td>
    <td class="gradehelp"><?php echo get_string("levelone", "memorybank")?></td>
    <td class="gradehelp"><?php echo get_string("leveltwo", "memorybank")?></td>
    <td class="gradehelp"><?php echo get_string("levelthree", "memorybank")?></td>
    <td class="gradehelp"><?php echo get_string("levelfour", "memorybank")?></td>
    <td class="gradehelp"><?php echo get_string("levelfive", "memorybank")?></td>
  </tr>
</table>

<input name="what" type="hidden" value="" />
<input name="instid" type="hidden" value="<?php echo ($instid); ?>" />
<input name="qid" type="hidden" value="<?php echo ($qid); ?>" />
<input name="starttime" id = "starttime" type="hidden" value="<?php echo time(); ?>" />
<input name="jsstarttime" type="hidden" />
<input name="jsendtime" type="hidden" />
<script type="text/javascript" language="javascript">

var jstimeDate = new Date();
    var jstime = jstimeDate.getTime();
	//document.write(jstime);
	document.SendAnswers.jsstarttime.value = jstime;
</script>
</form>



<div class="mystats"><?php echo get_string("questionsremaining", "memorybank")?><?php echo $qcount ?> | Question id: <?php echo $qid ?></div>
</div>

<script type="text/javascript" language="javascript">
document.getElementById('myshowanswer').focus();
</script>

<?php }?>